package com.sr.examination.home.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.sr.examination.R;
import com.tl.commonlibrary.ui.adapter.IAdapter;
import com.tl.commonlibrary.ui.adapter.ViewHolder;
import com.tl.commonlibrary.ui.beans.ExamCategory;

import java.util.List;

/**
 * Created by JongSung on 18/2/26.
 */

public class ExamCategoryAdapter extends IAdapter<ExamCategory> {
    public static int[] colors = new int[]{R.drawable.bg_exam_category01, R.drawable.bg_exam_category02, R.drawable.bg_exam_category03, R.drawable.bg_exam_category04, R.drawable.bg_exam_category05, R.drawable.bg_exam_category06};

    public ExamCategoryAdapter(Context context, List<ExamCategory> datas) {
        super(context, datas, R.layout.item_exam_category);
    }

    @Override
    protected void getView(ViewHolder viewHolder, ExamCategory entity, int position, View convertView, boolean isConvert, int itemViewType, ViewGroup parent) {
        TextView titleTView = viewHolder.getView(R.id.titleTView);
        titleTView.setText(entity.getTitle());
        titleTView.setBackgroundResource(colors[position % colors.length]);
    }

    @Override
    public void onClick(View v) {

    }
}
